<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>中国联通演示机租赁PMS系统</title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link rel="stylesheet" th:href="@{/admin/css/other/login/login.css}" />
    <link rel="stylesheet" th:href="@{/admin/css/other/login/vendor/bootstrap/css/bootstrap.min.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/other/login/fonts/font-awesome-4.7.0/css/font-awesome.min.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/other/login/fonts/iconic/css/material-design-iconic-font.min.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/other/login/css/util.css}"/>
    <link rel="stylesheet" th:href="@{/admin/css/other/login/css/main.css}"/>
    <style>
        .div_foot
        {
            margin-top: -50px;
            position: absolute;
            text-align: center;
            line-height: 50px;
            width: 100%;
        }
    </style>
</head>
<body>
<!-- 代 码 结 构 -->
<div class="limiter">
    <div class="container-login100" style="background-image: url('/admin/css/other/login/images/web_login_bg.jpg');">
        <div class="wrap-login100 p-l-55 p-r-55 p-t-65 p-b-54">
            <form class="layui-card-body layui-form layui-form-pane">
                <span class="login100-form-title p-b-49">中国联通演示机租赁PMS系统</span>

                <div class="wrap-input100 validate-input m-b-23" data-validate="请输入用户名">
                    <span class="label-input100">用户名</span>
                    <input class="input100" lay-verify="username"  type="text" name="account" placeholder="请输入用户名" autocomplete="off">
                    <span class="focus-input100" data-symbol="&#xf206;"></span>
                </div>

                <div class="wrap-input100 validate-input" data-validate="请输入密码">
                    <span class="label-input100">密码</span>
                    <input class="input100" lay-verify="required|password"  type="password" name="password" placeholder="请输入密码">
                    <span class="focus-input100" data-symbol="&#xf190;"></span>
                </div>
                <div class="wrap-input100 validate-input" data-validate="请输入密码" style="margin-top: 10px">
                    <span class="label-input100">验证码</span>
                    <img alt="验证码" id="captchaImage" src="/system/captcha/generate" onclick="reloadCode()" style="
                    position: absolute;
                    bottom: 0;
                    right: 0;
                    cursor: pointer;
                    ">
                    <input class="input100" lay-verify="code" style="width: 45%" name="captcha" value="" placeholder="请输入验证码" type="text">
                    <span class="focus-input100" data-symbol="&#xf106;"></span>
                </div>

                <div class="container-login100-form-btn" style="margin-top: 20px">
                    <div class="wrap-login100-form-btn">
                        <div class="login100-form-bgbtn"></div>
                        <button class="login100-form-btn" lay-filter="login-submit" id="login-button" lay-submit="">登 录</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
    <div class="div_foot"><a href="https://beian.miit.gov.cn/" target="view_window">粤ICP备2020141494号</a> | 版权所有©2021 深圳市百胜隆实业发展有限公司</div>
</div>
<script>
    layui.use(['form','jquery','layer','button','popup'], function() {
        let form = layui.form;
        let $ = layui.jquery;
        let layer = layui.layer;
        let button = layui.button;
        let popup = layui.popup;
        let captchaPath = "/system/captcha/generate";

        form.on('submit(login)', function(data){
            let loader = layer.load();
            let btn = button.load({elem: '.login'});
            $.ajax({
                url:'/login',
                data:data.field,
                type:"post",
                dataType:'json',
                success:function(result){
                    layer.close(loader);
                    btn.stop(function(){
                        if(result.success){
                            popup.success(result.msg,function(){
                                location.href = "/index";
                            })
                        }else{
                            popup.failure(result.msg,function(){
                                document.getElementById("captchaImage").src=captchaPath + "?" + Math.random();
                            });
                        }
                    })
                }
            });
            return false;
        });

        $("#captchaImage").click(function(){
            document.getElementById("captchaImage").src= captchaPath + "?" + Math.random();
        })
        setInterval(function(){
            document.getElementById("captchaImage").src= captchaPath + "?" + Math.random();
        },30 * 1000);
        validateKickout();
    })
</script>
<script>
    if(window!=top){ top.location.href = location.href; }

    function validateKickout() {
        if (getParam("abnormalout") == 1) {
            layer.alert("<font color='red'>您已在别处登录，请您修改密码或重新登录</font>", {
                    icon: 0,
                    title: "系统提示"
                },
                function(index) {
                    layer.close(index);
                });
        }else if(getParam("sessionout") == 1){
            layer.alert("<font color='red'>登录已过期，请重新登录</font>", {
                    icon: 0,
                    title: "系统提示"
                },
                function(index) {
                    layer.close(index);
                });
        }
    }

    function getParam(paramName) {
        var reg = new RegExp("(^|&)" + paramName + "=([^&]*)(&|$)");
        var r = window.location.search.substr(1).match(reg);
        if (r != null) return decodeURI(r[2]);
        return null;
    }
</script>
</body>
</html>